package com.liangwj.springbootweb.services.impl;

import com.liangwj.springbootweb.domain.User;
import com.liangwj.springbootweb.services.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * TODO: UserServiceImpl实现类 接入jdbcTemplate
 * @author Liangwenjun
 * @date 2018-12-13
 * @version 1.0
 */
@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void createUser(User user) {
        jdbcTemplate.update("");
    }

    @Override
    public List<User> getAllUser() {
        return jdbcTemplate.queryForList("", User.class);
    }

    @Override
    public User getUserByCondition(User user) {
        return jdbcTemplate.queryForObject("", User.class);
    }

    @Override
    public void updateUser(User user) {
        jdbcTemplate.update("");
    }

    @Override
    public void deleteUser(Long id) {
        jdbcTemplate.update("delete from user");
    }
}
